import { ViteSSG } from 'vite-ssg';
import { setupLayouts } from 'virtual:generated-layouts';

import App from './App.vue';
import type { UserModule } from './types';
import generatedRoutes from '~pages';

// import '@unocss/reset/tailwind.css'; // 导致el-button的样式失效
import './styles/main.css';
import 'uno.css';

const routes = setupLayouts(generatedRoutes);

export const createApp = ViteSSG(App, { routes, base: import.meta.env.BASE_URL }, (ctx) => {
  // install all modules under `modules/`
  Object.values(
    import.meta.glob<{ install: UserModule }>('./modules/*.ts', { eager: true }),
  ).forEach((i) => i.install?.(ctx));
});
